package com.lwq.model;

import lombok.Data;

/**
 * Description:
 * Author: LiuWenQing
 * Datetime: 2021/6/10
 */
@Data
public class Result {

    private String code;
    private String msg;
    private Object data;

    public static Result ok(){
        Result r = new Result();
        r.setCode("200");
        r.setMsg("操作成功");
        return r;
    }

    public static Result error(){
        Result r = new Result();
        r.setCode("500");
        r.setMsg("操作失败");
        return r;
    }

    public static Result error(String msg){
        Result r = new Result();
        r.setCode("500");
        r.setMsg(msg);
        return r;
    }

    public static Result ok(Object o){
        Result r = new Result();
        r.setCode("200");
        r.setMsg("操作成功");
        r.setData(o);
        return r;
    }

    public static Result ok (String msg, Object o){
        Result r = new Result();
        r.setCode("200");
        r.setMsg(msg);
        r.setData(o);
        return r;
    }

}
